﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace canyinguanlixitong
{
    public partial class frmas1qw6 : Form
    {
        public frmas1qw6()
        {
            InitializeComponent();
        }
        string str = "Data Source=.;Initial Catalog=Supermarket management system;Integrated Security=True";
        private void button7_Click(object sender, EventArgs e)
        {
            add();
        }
        public void add() {
             SqlConnection conn = new SqlConnection(str);
             try
             {
                 DataSet ds = new DataSet("Student");
                 string sql = "select userName,userID,userQi from dbo.UserTpye where userName like'%"+this.textBox3.Text+"%'";
                 SqlDataAdapter asdf = new SqlDataAdapter(sql, conn);
                 asdf.Fill(ds, "Student");
                 dataGridView3.DataSource = ds.Tables["Student"];
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message);
             }

        
        }
      
    }
}
